package behavioral.strategy;

//如果项目中有 大量的if， else 可以使用这个策略模式。。
public class Main {
    //1.
    /*public static void main(String[] args) {
        PromotionActivity promotionActivity618 = new PromotionActivity(new LiJianPromotionStrategy());
        PromotionActivity promotionActivity1111 = new PromotionActivity(new ManJianPromotionStrategy());

        promotionActivity1111.executePromotionActivity();
        promotionActivity618.executePromotionActivity();
    }*/

    //2.
    /*public static void main(String[] args) {
        PromotionActivity promotionActivity = null;

        String promotionKey = "LiJian";
        if(StringUtils.equals(promotionKey,"LiJian")){
            promotionActivity = new PromotionActivity(new LiJianPromotionStrategy());
        }else if(StringUtils.equals(promotionKey,"FanXian")){
            promotionActivity = new PromotionActivity(new FanXianPromotionStrategy());
        }

        promotionActivity.executePromotionActivity();
    }*/

    //3. 工厂 和 策略模式的组合使用。
    public static void main(String[] args) {
        String promotionKey = "LiJian";
        PromotionActivity promotionActivity = new PromotionActivity(PromotionStrategyFactory.getPromotionStrategy(promotionKey));
        promotionActivity.executePromotionActivity();
    }
}
